package cn.vortex.device.web.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author vortex
 * @create 2020-06-08 21:37
 */
@WebFilter(filterName = "CSSFilter")
public class CSSFilter implements Filter {
    public void destroy() {
    }

    //新java配置
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        //设置请求编码格式
        req.setCharacterEncoding("utf-8");  //post 改变(请求实体)
        //设置响应编码格式
        resp.setContentType("text/css;charset=utf-8");//修改响应编码
        chain.doFilter(req, resp);
    }


    public void init(FilterConfig config) throws ServletException {

    }

}
